<template>
	<view>
		<view class="map_container">
			<map class="map" id="map" :longitude="longitude" :latitude="latitude" scale="14" show-location="true" :markers="markers"></map>
		</view>
	</view>
</template>

<script>
	import bmap from '@/utils/bmap-wx.min.js';
	var wxMarkerData = [];
	export default {
		data() {
			return {
				markers: [],
				latitude: '',
				longitude: '',
				rgcData: {}
			}
		},
		onLoad: function() {
			var that = this;
			// 新建百度地图对象 
			var BMap = new bmap.BMapWX({
				ak: 'DdVBt5s2PzN85jYFEaI6RurjGmjaO9Ua'
			});
			var fail = function(data) {
				console.log(data)
			};
			var success = function(data) {
				wxMarkerData = data.wxMarkerData;
				console.log('wxMarkerData----',wxMarkerData);
				that.markers = wxMarkerData;
				that.latitude = wxMarkerData[0].latitude;
				that.longitude = wxMarkerData[0].longitude;
			}
			// 发起regeocoding检索请求 
			BMap.regeocoding({
				location: '24.49685,117.654111',
				fail: fail,
				success: success,
				iconPath: '/static/marker_red.png',
				iconTapPath: '/static/marker_red.png'
			});
		},

		methods: {

		}
	}
</script>

<style>
	.map_container {
		height: 100vh;
		width: 100%;
	}

	.map {
		height: 100%;
		width: 100%;
	}

	.rgc_info {
		padding: 0 5px;
	}
</style>
